package com.bj58.ecdata.calc.dbservice.service.impl;

import java.util.List;

import com.bj58.ecdata.calc.dbservice.service.BaseService;
import com.bj58.ecdata.calc.dbservice.service.BusslineEnum;
import com.bj58.ecdata.calc.dbservice.service.PlatformEnum;
import com.bj58.ecdata.exception.BusinessException;
import com.google.common.collect.Lists;

/**
 * @author lichao
 *
 */
public abstract class BaseServiceImpl implements BaseService {
	private List<String> types;
	private List<String> divTypes = Lists.newArrayList("cash", "cost");

	public BaseServiceImpl(List<String> types) {
		this.types = types;
	}

	@Override
	public String ping() {
		return "PONG";
	}

	@Override
	public String getDailySum() {
		return "";
	}

	@Override
	public String getDailySum(PlatformEnum platform, BusslineEnum bussline) {
		return "";
	}

	@Override
	public String getDataTodayMinute(String type, long time) {
		return "";
	}

	protected void checkType(String type) {
		if (!types.contains(type)) {
			throw new BusinessException("error type! (%s)", type);
		}
	}

	protected boolean isDiv(String type) {
		return divTypes.contains(type);
	}

}
